package org.liuyunfeng.domain;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


/**
 * @description:
 * @author: TanJingyu
 * @create: 2022-01-05 14:51
 **/
@Repository
public interface ExcellentEnterpriseSelectionMapper {

    Boolean insert(ExcellentEnterpriseSelectionApplication application);

    Boolean update(ExcellentEnterpriseSelectionApplication application);

    /**
     * 快速查询用户是否提交成功申请
     */
    @Select("SELECT DISTINCT 1 FROM excellent_enterprise_selection_application WHERE create_user_open_id = #{openId} AND apply_success = #{applySuccess}")
    int applySuccess(@Param("openId") String openId, @Param("applySuccess") Boolean applySuccess);

    /**
     * 查询用户是否填写了信息
     */
    @Select("SELECT DISTINCT 1 FROM excellent_enterprise_selection_application WHERE create_user_open_id = #{openId} AND create_time IS NOT NULL")
    int isWrite(@Param("openId") String openId);

    /**
     * 查询用户填写的信息
     */
    @Select("SELECT * FROM excellent_enterprise_selection_application WHERE create_user_open_id = #{openId}")
    ExcellentEnterpriseSelectionApplication findByOpenId(@Param("openId") String openId);
}

    